package org.escom.profesor.managedbean;

import java.io.Serializable;

import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;

import org.escom.profesor.serviceimpl.ProfesorService;

@ManagedBean
@ViewScoped
public class ProfessorBean implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String cajaTexto;
	private ProfesorService profesorService;

	public void init() {
		System.out.println("hola soy un Professor bean: ");
	}

	public String getCajaTexto() {
		return cajaTexto;
	}

	public void setCajaTexto(String cajaTexto) {
		this.cajaTexto = cajaTexto;
	}

	public ProfesorService getProfesorService() {
		return profesorService;
	}

	public void setProfesorService(ProfesorService profesorService) {
		this.profesorService = profesorService;
	}

	private String message;

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public void saveMessage() {
		FacesContext context = FacesContext.getCurrentInstance();
		if (!message.equals("1")) {
			context.addMessage(null, new FacesMessage("Successful",
					"Your message: " + message));
			context.addMessage(null, new FacesMessage("Second Message",
					"Additional Message " + "Detail"));
		}
	}

}
